]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Block cancellation of the unlock dialog when dragging
authorGiovanni Campagna <gcampagna@src.gnome.org>
Wed, 24 Oct 2012 15:53:19 +0000 (17:53 +0200)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Wed, 21 Nov 2012 11:35:55 +0000 (12:35 +0100)
Pressing esc while the mouse is down should not make the curtain fall,
otherwise a gray screen results.

https://bugzilla.gnome.org/show_bug.cgi?id=686800

js/ui/screenShield.js
js/ui/unlockDialog.js

index fd1645917269280bfeb439bd1cc7a7be2026078b..c016d83c63fbd30d250b22c0af3824605e7cc5fb 100644 (file)
@@ -502,7 +502,7 @@ const ScreenShield = new Lang.Class({
         if (symbol == Clutter.KEY_Escape ||
             symbol == Clutter.KEY_Return ||
             symbol == Clutter.KEY_KP_Enter) {
-            this._ensureUnlockDialog(true);
+            this._ensureUnlockDialog(true, true);
             this._hideLockScreen(true, 0);
             return true;
         }
@@ -525,7 +525,7 @@ const ScreenShield = new Lang.Class({
 
         // 7 standard scrolls to lift up
         if (this._lockScreenScrollCounter > 35) {
-            this._ensureUnlockDialog(false);
+            this._ensureUnlockDialog(false, true);
             this._hideLockScreen(true, 0);
         }
 
@@ -557,7 +557,7 @@ const ScreenShield = new Lang.Class({
     _onDragBegin: function() {
         Tweener.removeTweens(this._lockScreenGroup);
         this._lockScreenState = MessageTray.State.HIDING;
-        this._ensureUnlockDialog(false);
+        this._ensureUnlockDialog(false, false);
 
         return true;
     },
@@ -579,6 +579,7 @@ const ScreenShield = new Lang.Class({
             // Complete motion automatically
            let [velocity, velocityX, velocityY] = this._dragAction.get_velocity(0);
            this._hideLockScreen(true, -velocityY);
+            this._ensureUnlockDialog(false, true);
         } else {
             // restore the lock screen to its original place
             // try to use the same speed as the normal animation
@@ -661,7 +662,7 @@ const ScreenShield = new Lang.Class({
 
         this.actor.show();
         this._isGreeter = Main.sessionMode.isGreeter;
-        this._ensureUnlockDialog(true);
+        this._ensureUnlockDialog(true, true);
         this._hideLockScreen(false, 0);
     },
 
@@ -717,7 +718,7 @@ const ScreenShield = new Lang.Class({
             Main.sessionMode.popMode('lock-screen');
     },
 
-    _ensureUnlockDialog: function(onPrimary) {
+    _ensureUnlockDialog: function(onPrimary, allowCancel) {
         if (!this._dialog) {
             let constructor = Main.sessionMode.unlockDialog;
             if (!constructor) {
@@ -740,6 +741,8 @@ const ScreenShield = new Lang.Class({
             this._dialog.connect('failed', Lang.bind(this, this._onUnlockFailed));
             this._dialog.connect('unlocked', Lang.bind(this, this._onUnlockSucceded));
         }
+
+        this._dialog.allowCancel = allowCancel;
     },
 
     _onUnlockFailed: function() {
index 4db878c8ad9d50624687f2bfaa9b8beb6cea4a68..24a82a3acc6119c53a8e6ddeca118924efed9c38 100644 (file)
@@ -174,6 +174,7 @@ const UnlockDialog = new Lang.Class({
         this._workSpinner.actor.opacity = 0;
         this._workSpinner.actor.show();
 
+        this.allowCancel = false;
         this.buttonLayout.visible = true;
         this.addButton({ label: _("Cancel"),
                          action: Lang.bind(this, this._escape),
@@ -349,8 +350,10 @@ const UnlockDialog = new Lang.Class({
     },
 
     _escape: function() {
-        this._userVerifier.cancel();
-        this.emit('failed');
+        if (this.allowCancel) {
+            this._userVerifier.cancel();
+            this.emit('failed');
+        }
     },
 
     _otherUserClicked: function(button, event) {